Device for transforming motion